<?php


class BatchacmSubmissionViewWidget extends CWidget {

    public $submission;
    public $viewLevel = 0; //0, 1, 2

    public function run(){
        $sid = $this->submission->id;
        $contest_id = $this->submission->contest_id;
        $submitter_id = $this->submission->submitter_id;
        $problem_id = $this->submission->problem_id;

        $subs = Submission::model()->findAll(array(
                'condition' => "score = 0 AND id < $sid AND submitter_id = $submitter_id AND problem_id = $problem_id AND contest_id = $contest_id"
            ));
        $prev_subs = count($subs);

        $this->render('submissionview', array(
            'submission' => $this->submission,
            'viewLevel' => $this->viewLevel,
            'prev_subs' => $prev_subs,
        ));
    }
    
}